const express = require('express')
const router = express.Router()
//导入expressJoi
const expressJoi = require('@escook/express-joi')

const userinfoHandler = require('../route_hander/userinfo')


//导入验证规则
const {
    name_limit,
    email_limit,
    password_limit,
    verifyEmail_limit,
} = require('../limit/user')



//上传头像
router.post('/uploadAvatar', userinfoHandler.uploadAvatar)
//绑定账号
router.post('/bindAccount', userinfoHandler.bindAccount)

// 修改用户密码
router.post('/changeUserPassword', expressJoi(password_limit), userinfoHandler.changeUserPassword)
//获取用户信息
router.post('/getUserInfo', userinfoHandler.getUserInfo)



// //修改姓名
// router.post('/changeName', expressJoi(name_limit), userinfoHandler.changeName)

// //修改性别
// router.post('/changeSex', userinfoHandler.changeSex)


// //修改邮箱
// router.post('/changeEmail', expressJoi(email_limit), userinfoHandler.changeEmail)

// //验证输入邮箱是否与注册邮箱一致

// router.post('/verifyAccountAndEmail', userinfoHandler.verifyAccountAndEmail)

// //登录页面修改密码

router.post('/changePasswordInLogin', userinfoHandler.changePasswordInLogin)
//获取全部用户信息
router.post('getAllUserInfo', userinfoHandler.getAllUserInfo)

//添加用户
router.post('/setUserInfo', userinfoHandler.setUserInfo)

// 修改用户信息
router.post('/updateUserInfo', userinfoHandler.updateUserInfo)

//删除用户信息
router.post('/deleteUserInfo', userinfoHandler.deleteUserInfo)
//获取所有部门名称

router.post('/getAllDepartment', userinfoHandler.getAllDepartment)
//根据部门id获取用户信息
router.post('/getUserInfoBydepartmentId', userinfoHandler.getUserInfoBydepartmentId)
//暴漏router对象
module.exports = router
